/*
 *	Copyright (c) 2010, tn
 *	All rights reserved.
 *
 *	Redistribution and use in source and binary forms, with or without
 *	modification, are permitted provided that the following conditions are met:
 *	    * Redistributions of source code must retain the above copyright
 *	      notice, this list of conditions and the following disclaimer.
 *	    * Redistributions in binary form must reproduce the above copyright
 *	      notice, this list of conditions and the following disclaimer in the
 *	      documentation and/or other materials provided with the distribution.
 *	    * Neither the name of the <organization> nor the
 *	      names of its contributors may be used to endorse or promote products
 *	      derived from this software without specific prior written permission.
 *
 *	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 *	ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 *	WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 *	DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
 *	DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 *	(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 *	ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <stdio.h>
#include <math.h>

#include "mcunit.h"

MCUNIT_TEST(setup);
MCUNIT_TEST(good_feature_x);
MCUNIT_TEST(broken_feature_y);
MCUNIT_TEST(cleanup);

/**
 * 	Test case setup example.
 */
mcunit_case_s tcase = {
		.name     = "Core case",
		.tests    = {
			/* Add tests here */
			{ .msg = NULL, .test = setup,            .name = "Setup"        },
			{ .msg = NULL, .test = good_feature_x,   .name = "Passing test" },
			{ .msg = NULL, .test = broken_feature_y, .name = "Failing test" },
			{ .msg = NULL, .test = cleanup,          .name = "Cleanup"      },

			/* Terminate list with NULL-ified test */
			{ .msg = NULL, .test = NULL,             .name = NULL           }
		}
};

/**
 * 	Test Suite setup example.
 */
mcunit_suite_s tsuite = {
		.name  = "Main suite",
		.cases = {
				/* Add pointers to cases here */
				&tcase,
				/* NULL-terminate list */
				NULL
		}
};

int main(void) {
	/* You can run individual tests and test cases */
	//mcunit_test_run(&tcase.tests[0]);
	//mcunit_case_run(&tcase);

	/* Run complete suite */
	mcunit_suite_run(&tsuite);

	printf("******* Report ********\n");
	//mcunit_case_report(&tcase, 1);
	mcunit_suite_report(&tsuite, 2);

	return 0;
}

MCUNIT_TEST(setup) {
	return 0;
}

MCUNIT_TEST(cleanup) {
	return 0;
}

MCUNIT_TEST(good_feature_x) {
	MCUNIT_ASSERT( 1 );
	return 0;
}

MCUNIT_TEST(broken_feature_y) {
	_test->msg = "I have a baaaad day today.";
	MCUNIT_ASSERT( 0 );
	return 0;
}
